<%@ Language=VBScript %>

<%
username = ucase(mid(Request.ServerVariables("LOGON_USER"),6,len(Request.ServerVariables("LOGON_USER"))))

set con = Server.CreateObject ("ADODB.connection")
Con.Open (application("ConDB_OVCC"))

query = "SELECT id_persona, nome, cognome, Reportistica, Mansione, Call_Center, Abilitato, data_nascita FROM dbo.PERSONE where abilitato=1 and id_persona='" & username & "'"

'Response.Write 

set rs = con.Execute (query)
if not rs.eof then	
	'Response.Write rs(4)
	if ((mid(rs(4),1,7) = "Access_") or (mid(rs(4),1,7) = "Admin") or (rs(4) = "Rep")) or ((ucase(rs(5)) = "ALL")) then
		accesso = 1
	end if

else
	accesso = 0
end if

Response.Write accesso
%>